<?php
/**
 * User: hufeng
 * Date: 2016/12/25
 * Desc：短信类库
 */
namespace Common\Util;

class Sms{

    public function smsSend($tel,$param,$tplType){
        require_once(VENDOR_PATH."alidayu/TopSdk.php");
        $aldyConf = C('ALIDAYU');

        $c = new \TopClient;
        $c->appkey = $aldyConf['appkey'];
        $c->secretKey = $aldyConf['secretKey'];
        $req = new \AlibabaAliqinFcSmsNumSendRequest;
        $req->setSmsType($aldyConf['setSmsType']);
        $req->setSmsFreeSignName($aldyConf['signName']);
        $req->setSmsParam(json_encode($param));
        $req->setRecNum($tel);
        $req->setSmsTemplateCode($aldyConf[$tplType]);
        $resp = $c->execute($req);
        return $resp;
    }
}